package com.ibm.cps.processors.deletion;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class PartialSearch {

	public static List<String> getAffectedProcessors(String deletedId,
			HashMap<String, Set<String>> parent2Successors) {
		List<String> parents = new ArrayList<String>();
		if (deletedId == null) {
			return parents;
		}
		// Get all parent processors including this subprocessor
		for (Map.Entry<String, Set<String>> entry : parent2Successors
				.entrySet()) {
			if (entry.getValue().contains(deletedId)) {
				parents.add(entry.getKey());
			}
		}

		return parents;
	}
}
